package io.vector.study.concurrent;

import java.util.concurrent.CountDownLatch;

/**
 * Created by vector on 2017/3/10.
 */
public class WorkerThread extends Thread {

    private String name;

    private CountDownLatch countDownLatch;

    public WorkerThread(Runnable runnable, CountDownLatch countDownLatch) {
        super(runnable);
        this.countDownLatch = countDownLatch;
    }

    public WorkerThread(String name, Runnable runnable, CountDownLatch countDownLatch) {
        super(runnable, name);
        this.countDownLatch = countDownLatch;
    }

    @Override
    public void run() {
        super.run();
        countDownLatch.countDown();
    }

}
